<html>
    <head>
        <title>EBU Broadcast Hotspot - Synopsis</title>
        <meta name="robots" content="noindex, nofollow">
        <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
<body>

    <div class="container">
        <div class="logo">
            <a href="http://tech.ebu.ch"><img src="http://www.ebulabs.org/radiovismanager/img/ebulogo.png" /></a>
        </div>
        <div class="head">

            <h1>Synopsis</h1>

            <div class="contact"><b>Contact</b>
                <p><address>Author: <b>Matthias Br&auml;ndli</b><br /><i>mpbraend@gmail.com</i></address></p>
                <p><address>Contact: <b>Mathias Coinchon</b><br /><i>coinchon@ebu.ch</i><br /><i>+41 22 717 27 16</i></address></p>
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>


    <div class="chapeau">This page describes the hotspot and explains how it works.</div>


    <h2>Introduction</h2>
    <p>A broadcast hotspot is a piece of hardware which allows a user to receive a over-the-air broadcast signal on a device
    that does not have a corresponding receiver. The hotspot therefore must receive the signal, if necessary recode it into
    a format that the user device can play, and transmit it over a medium which the user device can communicate over. In most
    scenarios, this medium is WiFi, because it is well-supported and available on most devices.</p>

    <p>On the user device, a dedicated application has to communicate with the hotspot. This application enables the user to choose
    between different receivers, presents the programmes and plays the content. Furthermore, for radio applications, it also
    receives slideshow and text data from <a href="http://www.radiodns.org">RadioDNS</a>.</p>

    <p>In this project, the hotspot is implemented in software on a linux computer using only standard hardware (except maybe for
    a USB DAB receiver). This software is described here.</p>


    <h2>Components</h2>
    <p>This hotspot is able to receive DAB radio using <a href="http://www.openmokast.org">OpenMokast</a>. It has been tested with the 
    Albrecht DR 403 USB receiver and with several ETI files as input. The audio data from OpenMokast is then converted to a format the
    user device can play using <a href="http://videolan.org/vlc/">VLC</a>. VLC streams the converted audio to the user device using WiFi, 
    which plays it. The user device also does the RadioDNS requests and fetches the slideshow by itself.</p>

    <p>The interaction between all these components is handled by the Hotspot Daemon.</p>

    <p>In summary, the system is made of the following components:</p>
    <ul>
        <li>A USB DAB receiver, controlled by OpenMokast;</li>
        <li>An audio converter, VLC;</li>
        <li>An application on the user device;</li>
        <li>A deamon supervising and controlling the different elements.</li>
    </ul>

    <p>These elements will now be presented in detail.</p>

    <h3>Hotspot Daemon</h3>
    <p>The Hotspot Daemon is the central piece of the whole system. It receives commands from the user device, controls OpenMokast, and
    instanciates audio converters when necessary. It is written in python and is split in several files. <b>The file one has to call to
        invoke the hotspot is <span class="cmd">hotspotd.py</span></b>.</p>

    <p>User commands are received using a HTTP+XML interface, which is reachable on <b>TCP port 8080</b>. If the hotspot is accessed using a standard
    browser, a simple control web-page is presented, on which it is possible to</p>
    <ul>
        <li>See the different receiver technologies and their capabilities;</li>
        <li>Set the frequency for a receiver;</li>
        <li>Get a list of programmes for a receiver;</li>
        <li>Set the programme one wants to receive;</li>
        <li>Reset the different technologies to the default state.</li>
    </ul>

    <p>The same interface is used by the user device, but instead of being accessed from using a browser, the application presents it in a more
    convenient fashion to the user.</p>

    <p><b>For the end user</b>, using the browser is required if one wants to change the frequency, because the application does not yet have a way to
    do this.</p>

    <p>The hotspot sends commands to OpenMokast using its <a href="http://dbus.freedesktop.org/">dbus</a> interface, which presents nearly the same
    commands as the telnet interface. Some changes had to be made, which are saved in a dedicated repository. These commands are used to find information
    about an ensemble or a service (EID, SID, Service Component ID, sub-channel ID), to select a programme and to set the receiver frequency.</p>

    <p>The use of dbus has the following consequences for the hotspot:</p>
    <ul>
        <li>OpenMokast has to be started <b>before</b> hotspotd, otherwise the latter will try to launch OpenMokast.</li>
        <li>If no dbus-enabled graphical session is running, or if the hotspot is started on the linux text console, there will be no running dbus session bus.
        It is therefore required to <b>start a dbus session manually</b>.
        This can be easily achieved using <span class="cmd">dbus-launch screen</span>.</li>
    </ul>

    <h3>Receiver and OpenMokast</h3>
    <p>The open-source version of OpenMokast is capable of decoding MP2 DAB services, which in turn can be read by several audio players, including mplayer and VLC.
    However, the open-source version does not extract the AAC bit-stream from DAB+ programmes, which makes it impossible to decode those programmes. Furthermore, there
    are no open-source programs that can convert DAB+ super-frames to an AAC that is readable by standard audio players.</p>

    <p><b>For this reason, the hotspot only works for DAB (MP2) services</b></p>

    <p>OpenMokast streams to VLC using MP2 over HTTP.</p>

    <h3>Audio Converter</h3>
    <p>Since not all devices are able to decode MP2, it is required to recode them to a supported format. For the sake of practicality, MP3 has been chosen, because
    it is supported by the platforms that were initially targeted (Android and iOS).</p>

    <p>VLC supports HTTP streaming in a similar fashion to <a href="http://icecast.org">IceCast</a>, which is known to be well supported on many devices, thanks
    to the compatibility to the <a href="http://www.shoutcast.com">SHOUTcast</a> tools.</p>

    <p>When the user asks for a programme, the corresponding VLC is invoked by the Hotspot Daemon, and starts re-encoding the audio stream from OpenMokast. This
    new MP3 stream is then made available to the user device through HTTP.</p>

    <h3>User Device Application</h3>
    <p>An android phone has been chosen as development platform for the end user device.</p>
    <p>The android application (called <span class="cmd">broadcastinghostpot</span>) connects to the Hotspot Daemon and to the VLC streams. It uses the HTTP+XML
    interface to receive information concerning receiver technologies, programmes and programme details, and to instruct the hotspot on what to do.</p>
    <p>Furthermore, it includes a RadioVis client, and shows the slideshow related to the selected programme.</p>


    <h2>Features in development</h2>
    <h3>DVB-T</h3>

    <p>Using a DVB-T USB receiver, and VLC to transcode the video format, it would be quite simple to adapt the hotspot to support video. The correct parameters
    for the transcoding have been worked out, and there is an example of how to invoke VLC correctly in the repository.</p>

    <p>There are some missing element for this to work. For one thing, a way has to be found to interact with a running instance of VLC, to make it possible
    to change the programme. There are several interfaces to control VLC, but none of which offer this functionality.
    Additionally, the device controller in the Hotspot Daemon has to be written, once it is known how to control VLC. Lastly, the android application must be made
    aware of the video stream, and RadioDNS must be disabled for DVB. There already is an example application that can receive a video-stream encoded by VLC
    called <span class="cmd">mediaplayer</span>, found in the <span class="cmd">eclipse/</span> folder.</p>


    <h3>Zeroconf auto-discovery</h3>
    <p>The hotspot publishes its service using the <a href="http://www.avahi.org">Avahi</a>, an implementation of the <a href="http://www.zeroconf.org">Zeroconf</a>
    mDNS service discovery. Due to some unsolved issues, the service discovery is not reliable enough for a demo, and has been disabled. From time to time, the 
    advertised URL only contains an IPv6 address, which is problematic since it is assumed that the user devices only support IPv4.
    The URL to the hotspot is now set manually in the user device.</p>

    <h3>Delay when starting stream</h3>
    <p>There is a very long delay when the user clicks on a programme. It is certainly possible to reduce it, and to make the user interface more responsive.</p>

    <div class="footer">&copy; 2011, European Broadcasting Union<span class="footerauthor">September 2011, Matthias P. Br&auml;ndli</span></div>

</body></html>
